class Solution(object):
    def reverseVowels(self, s):
        """
        :type s: str
        :rtype: str
        """
        vowels = set(['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'])
        s = list(s)
        begin = 0
        end = len(s)-1
        while begin<end:
            while begin<end and s[begin] not in vowels: begin+=1
            while begin<end and s[end] not in vowels: end-=1
            if begin<end:
                tmp=s[begin]
                s[begin]=s[end]
                s[end]=tmp
                begin+=1
                end-=1
        return "".join(s)

print(Solution().reverseVowels('hello'))